package demo1;

abstract class r{
    //default void fun(){

    //}
}
class shape{
    protected int a;
    public void print(){
        System.out.println("打印图形");
    }
}

class circle extends shape{

    @Override
    public void print() {
        System.out.println("⚪⚪⚪");
    }

}

class sct extends shape{
    @Override
    public void print() {
        System.out.println("🔺🔺🔺");
    }

}

class rectangle extends shape{
    @Override
    public void print() {
        System.out.println("■ ■ ■");
    }

}

public class javaTest {
    /**
     * 图形打印函数(该函数实现了不同图形打印的多态)
     * @param shape1
     */
    public static void showShape(shape shape1){
        shape1.print();
    }

    public static void main(String[] args) {
     shape circle= new circle();
     shape sct=new sct();
     shape rectangle=new rectangle();

     //调用函数实现多态
     showShape(circle);
     showShape(sct);
     showShape(rectangle);

        shape shape1=new shape();
        System.out.println(shape1.a);
    }

}
